package com.hy.study.dto;

public class Student implements Comparable<Student> {

    private int code;
    private Integer age;

    public int getCode() {
        return code;
    }

    public void setCode(int code) {
        this.code = code;
    }

    public Integer getAge() {
        return age;
    }

    public void setAge(Integer age) {
        this.age = age;
    }

    @Override
    public int compareTo(Student o) {
        if (code == o.code) {
            return 0;
        } else if (code < o.code) {
            return -1;
        } else {
            return 1;
        }
    }

    @Override
    public String toString() {
        return "Student{" +
                "code=" + code +
                ", age=" + age +
                '}';
    }
}